import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/Index'
import Main from '@/views/Main'
import Recommentproduct from '@/views/main/RecommendProduct'
import ForgetPassword from '@/views/userAccount/Forget-password'
import Mine from '@/views/main/Mine'
import Home from '@/views/main/Home'
import Login from '@/views/Login'
import Feedback from '@/views/setting/Feedback'
import Myfoot from '@/views/My-foot'
import Aboutus from '@/views/setting/About-us'
import Registerassociation from '@/views/Register-association'
import Helpcenter from '@/views/main/mine/Help-center'
import Modifypassword from '@/views/setting/Modify-password'
//import Improveinformation from '@/views/Improve-information'
import Loanplatformdetail from '@/views/Loan-platform-detail'
import Setting from '@/views/Setting'
import Setpassword from '@/views/Set-password'
import Discover from '@/views/main/Discover'
import Activity from "@/views/Activity"
import Method from '@/views/Method'
import Applyloan from '@/views/Apply-loan'
import Mydiscover from '@/views/main/mine/My-discover'
import Myfavorite from '@/views/main/mine/My-favorite'  //这儿是我的收藏模块的父组件
import Mycomment from '@/views/main/mine/My-comment'  //这儿是我的评论模块的父组件
import Applyrecord from '@/views/main/mine/Apply-record'
import Creditcertification from '@/views/main/mine/Credit-certification'
import Person from '@/views/main/mine/certification/Person-message'
import Namecertification from '@/views/main/mine/certification/Name-certification'
import Artical from '@/views/main/mydiscover/Artical'
import Messageselected from '@/views/main/mydiscover/Message-selected'
import Sponsorassess from '@/views/main/mydiscover/Sponsor-assess'
import Assess from '@/views/main/mydiscover/Assess'
import Product from '@/views/main/mine/mydiscover/Product'  //添加足迹产品页面功能，author:li
import Zixun from '@/views/main/mine/mydiscover/Zixun'
import Tiezi from '@/views/main/mine/mydiscover/Tiezi'
import FavoriteProduct from '@/views/main/mine/myfavorite/Product'  //添加收藏产品页面功能，author:li
import FavoriteZixun from '@/views/main/mine/myfavorite/Zixun'      //添加收藏资讯页面功能，author:li
import FavoriteTiezi from '@/views/main/mine/myfavorite/Tiezi'      //添加收藏帖子页面功能，author:li
import Publish from '@/views/main/mine/mycomment/mypublish'             //添加我的发布与评论中的发布页面功能，author:li
import Comment from '@/views/main/mine/mycomment/mycomments'             //添加我的发布与评论中的提交页面功能，author:li
import Discuss from '@/views/main/discover/Discuss'
import Selected from '@/views/main/discover/Selected'
import EnchashList from '@/views/main/mine/enchash/enchashList'
import chashDetails from '@/views/main/mine/enchash/chashDetails'
import getMoney from '@/views/main/mine/enchash/getMoney' 
import repayStatus from '@/views/main/mine/enchash/repayStatus'
import Mycard from '@/views/main/mine/myCard/mycard'
import Addcard from '@/views/main/mine/myCard/addcard'
import Changecard from '@/views/main/mine/myCard/changecard'
import ShouTogetchash from '@/views/main/mine/enchash/shouTogetchash'
import Register from '@/components/Register'
import MainRegister from '@/views/userAccount/Register'
import CompleteInformation from '@/views/userAccount/complete-information'
import IdentityAuthentication from '@/views/userAccount/identity-authentication'
Vue.use(Router)

export default new Router({
    scrollBehavior (to, from, savedPosition) { //表示的是点击路由的时候导航条返回顶部
        return {y: 0 }
      },
    routes: [{
        path: '/',
        name: 'Index',
        component: Index,
        redirect: '/main/home',
        children: [{
                path: '/main',
                name: 'main',
                component: Main,
                children: [{
                        path: 'home',
                        name: 'home',
                        title: '水珠钱包',
                        component: Home
                    },
                    {
                        path: 'recommentproduct',
                        name: 'recommentproduct',
                        title: '水珠钱包',
                        component: Recommentproduct
                    }, {
                        path: 'mine',
                        name: 'mine',
                        title: '水珠钱包',
                        component: Mine,
                        beforeEnter: (to, from, next) => {
                          to.meta.prePath = from.path;
                          next();
                        }
                    },
                    {
                        path: 'discover',
                        name: 'discover',
                        title: '发现',
                        component: Discover,
                        children: [{
                            path: '/main/discover/selected',
                            component: Selected
                        }, {
                            path: '/main/discover/discuss',
                            component: Discuss
                        }]
                    }
                ]
            },
            {
                path: 'mainregister',
                name: 'mainregister',
                component: MainRegister,

            },
            {
                path: 'login',
                name: 'login',
                component: Login,

            },
            {
                path: 'forgetpassword',
                title: '忘记密码',
                name: 'forgetpassword',
                component: ForgetPassword
            },
            {
                path: 'setting/feedback',
                name: 'feedback',
                title: '我要反馈',
                component: Feedback
            },
            {
                path: 'applyloan',
                name: 'applyload',
                title: '填写借款资料',
                component: Applyloan
            },
            {
                path: 'myfoot',
                name: 'myfoot',
                title: '我的足迹',
                component: Myfoot
            },
            {
                path: 'setting/aboutus',
                name: 'aboutus',
                title: '关于我们',
                component: Aboutus
            },
            {
                path: 'registerassociation',
                name: 'registerassociation',
                title: '水珠钱包注册协议',
                component: Registerassociation
            },
            {
                path: 'main/mine/helpcenter',
                name: 'helpcenter',
                title: '帮助中心',
                component: Helpcenter
            },
            {
                path: 'setting/modifypassword',
                name: 'modifypassword',
                title: '修改密码',
                component: Modifypassword
            },
            // {
            //     path: 'improveinformation',
            //     name: 'improveinformation',
            //     title: '完善个人信息',
            //     component: Improveinformation
            // },
            {
                path: 'loanplatformdetail',
                name: 'loanplatformdetail',
                title: '借款平台详情',
                component: Loanplatformdetail
            },

            {
                path: 'setting',
                name: 'setting',
                title: '设置',
                component: Setting
            },
            {
                path: 'setpassword',
                name: 'setpassword',
                title: '设置登录密码',
                component: Setpassword
            },
            {
                path: 'completeInformation',
                name: 'completeInformation',
                title: '完善资料',
                component: CompleteInformation,
                beforeEnter: (to, from, next) => {
                  to.meta.prePath = from.path;
                  next();
                }
            },
            {
                path: 'completeInformation/identityAuthentication',
                name: 'identityAuthentication',
                title: '身份认证',
                component: IdentityAuthentication,
                beforeEnter: (to, from, next) => {
                  to.meta.prePath = from.path;
                  next();
                }
            },
            {
                path: 'activity',
                name: 'activity',
                title: '活动',
                component: Activity
            },
            {
                path: 'method',
                name: 'method',
                title: '提额妙招',
                component: Method
            },
            {
                path: 'main/mine/mydiscover',
                name: 'mydiscover',
                title: '我的发现',
                component: Mydiscover,
                children: [ {
                    path: '/main/mine/mydiscover/Product',  //添加产品页面功能，author:li
                    component:Product
                },{
                    path: '/main/mine/mydiscover/Zixun',
                    component: Zixun
                }, {
                    path: '/main/mine/mydiscover/Tiezi',
                    component: Tiezi
                }
               ]
            },
            {
                path: 'main/mine/myfavorite', 
                name: 'myfavorite',
                title: '我的收藏',
                component: Myfavorite,   //引用父组件
                children: [ {            //配置的是子组件
                    path: '/main/mine/myfavorite/Product',  
                    component:FavoriteProduct  //收藏页面的产品组件
                },{
                    path: '/main/mine/myfavorite/Zixun',
                    component:FavoriteZixun    //收藏页面的资讯组件
                }, {
                    path: '/main/mine/myfavorite/Tiezi',
                    component:FavoriteTiezi   //收藏页面的帖子组件
                }
               ]
            },
            {
                path: 'main/mine/mycomment', 
                name: 'mycomment',
                title: '我的发布与评论',
                component: Mycomment,   //引用父组件
                children: [{
                    path: '/main/mine/mycomment/Pbulish',
                    component:Publish    //我的发布与评论页面的我的发布组件
                }, {
                    path: '/main/mine/mycomment/Comment',
                    component:Comment   //我的发布与评论页面的我的评论组件
                }
               ]
            },
            {
                path: 'mine/main/certification/personmessage',
                name: 'personmessage',
                title: '个人信息',
                component: Person
            },
            {
                path: 'main/mine/applyrecord',
                name: 'applyrecord',
                title: '申请记录',
                component: Applyrecord
            },

            //取现新功能
            {
                path: 'main/mine/enchash/enchashList',
                name: 'enchashList',
                title: '取现记录',
                component: EnchashList
            },
            {
                path: 'main/mine/enchash/chashDetails',
                name: 'chashDetails',
                title: '取现详情',
                component: chashDetails
            },
            {
                path: 'main/mine/enchash/repayStatus',
                name: 'repayStatus',
                title: '取现中',
                component: repayStatus
            },
            {
                path: 'main/mine/enchash/getMoney',
                name: 'getMoney',
                title: '我要取现',
                component: getMoney
            },
            {
                path: 'main/mine/myCard/mycard',
                name: 'mycard',
                title: '我的卡包',
                component: Mycard
            },
            {
                path: 'main/mine/myCard/addcard',
                name: 'addcard',
                title: '添加卡片',
                component: Addcard,
                beforeEnter: (to, from, next) => {
                  to.meta.prePath = from.path;
                  next();
                }
            },
            {
                path: 'main/mine/myCard/changecard',
                name: 'changecard',
                title: '添加卡片',
                component: Changecard
            },
            {
                path: 'main/mine/enchash/shouTogetchash',
                name: 'shouTogetchash',
                title: '取现确认',
                component: ShouTogetchash
            },
            //取现新功能
            {
                path: 'main/mine/creditcertification',
                name: 'creditcertificationq',
                title: '信用认证',
                component: Creditcertification
            },
            {
                path: 'main/mine/certification/namecertification',
                name: 'namecertification',
                title: '实名认证',
                component: Namecertification
            },
            {
                path: 'main/mydiscover/artical',
                name: 'artical',
                title: '论坛文章',
                component: Artical
            },
            {
                path: 'main/mine/mydiscover/messageselected',
                name: 'messageselected',
                title: '新闻精选',
                component: Messageselected
            },
            {
                path: 'main/mine/mydiscover/sponsorassess',
                name: 'sponsorassess',
                title: '发帖',
                component: Sponsorassess
            },
            {
                path: 'main/mine/mydiscover/assess',
                name: 'assess',
                title: '评论',
                component: Assess
            },
            {       
                path: 'main/myfavorite/artical',  //这里是收藏模块的子跳转路径
                name: 'myfavoriteartical',
                title: '论坛文章',
                component: Artical   //注意这里的组件是共用main/mydiscover文件夹里面的文件
            },
            {
                path: 'main/mine/myfavorite/messageselected',
                name: 'myfavoritemessageselected',
                title: '新闻精选',
                component: Messageselected
            },
            {
                path: 'main/mine/myfavorite/sponsorassess',
                name: 'myfavoritesponsorassess',
                title: '发帖',
                component: Sponsorassess
            },
            {
                path: 'main/mine/myfavorite/assess',
                name: 'myfavoriteassess',
                title: '评论',
                component: Assess                                                         
            },
            //渠道注册
            {
                path: '/register',
                name: 'register',
                title: '渠道注册',
                component: Register
            },
            // {
            //   path:'main/mine/mydiscover/zixun',
            //   name:'zixun',
            //   title:'资讯',
            //   component:Zixun
            // }
        ]
    }, ]
})